import Http from '../http';

export const login = function (loginForm: any) {
    return Http.post('/user/login', loginForm)
}

// export const menu = function() {
//     var user = Http.get(`/user/menu`);
//     console.log('menu',user)
//     user.push({});
//     return user;
// }


export const menu = async function () {
    const user = await Http.get(`/user/menu`);

    user.data.push(
        {
            icon: 'layui-icon-align-left',
            id: '/floor',
            title: '测试菜单',
            children: [
                {
                    icon: '',
                    id: '/floor/floor',
                    title: '楼管理'
                }
            ]

        },
        {
            icon: 'layui-icon-align-left',
            id: '/hostel',
            title: '宿舍管理',
            children: [
                {
                    icon: '',
                    id: '/hostel/live',
                    title: '成员管理'
                },
                {
                    icon: '',
                    id: '/hostel/label',
                    title: '标签管理'
                },
                {
                    icon: '',
                    id: '/hostel/apply',
                    title: '宿舍分配'
                }
            ]

        },
        {
            icon: 'layui-icon-align-left',
            id: '/student',
            title: '学生管理',
            children: [
                {
                    icon: '',
                    id: '/student/hostel',
                    title: '我的宿舍'
                },
            ]

        }
    );
    //console.log('menu', user);
    return user;
}


export const permission = function () {
    return Http.get('/user/permission')
}


